package online.afeibaili.storebackendframework.model

import jakarta.persistence.Entity
import jakarta.persistence.Id
import jakarta.persistence.Table


/**
 * 账户类
 *
 *@author AfeiBaili
 *@version 2025/10/17 16:02
 */

@Entity
@Table(name = "account")
class AccountEntity() {
    @Id
    var id: String = ""
    var nickname: String = ""
    var avatarUrl: String = ""
    var points: Int = 0
    var coupons: String = "[]"
    var token: String = ""
    var isVip: Boolean = false
    var lastLoginTime: Long = 0

    constructor(id: String, nickname: String, avatarUrl: String) : this() {
        this.id = id
        this.nickname = nickname
        this.avatarUrl = avatarUrl
        this.lastLoginTime = System.currentTimeMillis()
    }

    override fun toString(): String {
        return "AccountEntity(id='${id.take(5)}', nickname='$nickname', avatarUrl='$avatarUrl', points=$points, coupons='$coupons', token='$token', isVip=$isVip, lastLoginTime=$lastLoginTime)"
    }
}